<template>
  <div class="league_game_entry">
    <!-- banner -->
    <game-banner ref="gameBanner" :is-show-entry-btn="false" />

    <router-view :game-info="gameInfo" />
  </div>
</template>

<script>
import GameBanner from '../components/gameBanner';

import {
  api_GET_EventsManagementCompetitionWithRoute
} from '@/extend/api/gameswaggerApi/app';

export default {
  components: {
    GameBanner
  },
  data () {
    return {
      gameInfo: {}, // null 赛事信息
      gameRoute: '', // 赛事路由
      gameId: '',
      gameTenantId: '' // 赛事tenantId,
    };
  },
  created() {
    const $route = this.$route;
    const _paramsId = $route.params.id;
    this.gameRoute = _paramsId.split('_')[0];
    this.gameTenantId = _paramsId.split('_')[1] || '';

    this.getGameInfoByGameRoute();
  },
  methods: {
    // 根据赛事路由获取赛事信息
    getGameInfoByGameRoute() {
      const gameQO = {
        IncludeStatus: true,
        IncludeType: true,
        IncludeApproveStatus: true,
        IncludeLevel: true,
        IncludeSetting: true,
        IncludeReportSetting: true,
        IncludeEntryFields: true
      };
      gameQO.route = this.gameRoute;
      if (this.gameTenantId) {
        gameQO.__tenant = this.gameTenantId;
      }
      api_GET_EventsManagementCompetitionWithRoute(gameQO).then(res => {
        this.gameInfo = res || {};
        this.gameId = this.gameInfo.id;
        console.log('getGameInfoByGameRoute -> this.gameInfo', this.gameInfo);
      });
    }
  }
};
</script>

<style>
.league_game_entry .confirmInfo_title {
  position: relative;
  height: 32px;
  margin-bottom: 16px;
  line-height: 32px;
  font-size: 18px;
  font-weight: bold;
  color: #353434;
}
.league_game_entry .confirmInfo_title::after {
  display: block;
  content: "";
  position: absolute;
  left: -18px;
  top: 0;
  width: 6px;
  height: 32px;
  border-radius: 4px;
  background-color: #E02020;
}

.league_game_entry .gameEntry_shadow {
  border-radius: 8px;
  box-shadow: 0px 10px 36px 0px rgba(0,0,0,0.08);
}

.league_game_entry .control_row {
  padding-top: 30px;
}
</style>
